package com.a.lib_route.supplier

import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.launcher.ARouter

object SupplierNav {
    // ==========
    // = 快捷方法 =
    // ==========

    /**
     * 内部传入 GROUP 尽量各个模块直接通过对应 [build] 方法跳转
     * 便于代码跳转直观、对外避免跳转错 GROUP ( Module )
     */
    fun build(path: String): Postcard {
        return SupplierRouter.build(path)
    }

    fun buildMain(): Postcard {
        return SupplierRouter.build(SupplierRouter.PATH_MAIN)
    }
    // ==========
    // = 跳转方法 =
    // ==========

    /**
     * 模块入口路由跳转
     */
    fun routerMain() {
        build(SupplierRouter.PATH_MAIN).navigation()
    }

    // ====================
    // = PATH - IProvider =
    // ====================

    private var supplibrovider: ISupplibrovider? = null

    /**
     * 获取 Usbrovider
     * @return IUsbrovider?
     */
    fun supplibrovider(): ISupplibrovider? {
        if (supplibrovider == null) {
            supplibrovider = ARouter.getInstance().navigation(ISupplibrovider::class.java)
        }
        return supplibrovider
    }
}